/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.co.pas.spaceandtime.threads;

import org.apache.log4j.Logger;
import za.co.pas.business.constant.Constant;
import za.co.pas.spaceandtime.Main;
import za.co.pas.business.mvc.BusinessMVC;
import za.co.pas.spaceandtime.constant.STConstant;
import za.co.pas.spaceandtime.view.MainFrame;

/**
 *
 * @author alabuschagne
 */
public class MVCThread implements Runnable
{

    private static Logger logger = Logger.getLogger(MVCThread.class);
    private boolean running;
    private boolean stop = false;

    @Override
    public void run()
    {
        running = true;
        while (!stop)
        {
            try
            {
                Thread.sleep(100);
            }
            catch (InterruptedException ex)
            {
                logger.error(ex.getMessage(), ex);
            }
            if (Constant.mvc.canInit())
            {
                if (!Constant.mvc.isInit())
                {
                    Constant.mvc.init();
                }
            }
            if(STConstant.stMVC.canInit())
            {
                if (!STConstant.stMVC.isInit())
                {
                    STConstant.stMVC.init();
                }
            }
        }
        running = false;
    }

    /**
     * @return the running
     */
    public boolean isRunning()
    {
        return running;
    }

    /**
     * @param running the running to set
     */
    public void setRunning(boolean running)
    {
        this.running = running;
    }

    /**
     * @return the stop
     */
    public boolean isStop()
    {
        return stop;
    }

    /**
     * @param stop the stop to set
     */
    public void setStop(boolean stop)
    {
        this.stop = stop;
    }
}
